package org.lee.controller

import org.lee.bean.Person
import org.lee.bean.Response
import org.lee.bean.domain.Person1;
import org.lee.bean.domain.Person2;
import org.lee.bean.domain.SystemConfig
import org.lee.bean.domain.SystemConfig2
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController

@RestController
@RequestMapping("person")
class MyController {

//	@RequestMapping(value="search")
//	Response search(){
//		def sc = SystemConfig.findById(10)
//		println "sc is " + sc.toString()
//		println "sc2 is " + SystemConfig2.findById(12)
//		return new Response(code:0, message:'success')
//	}
	
	@RequestMapping(value="add")
	Response add(){
		Person1 p1 = new Person1(name:"lee1", age:10, dateCreated: new Date(), lastUpdated: new Date())
		p1.save()
		
		Person2 p2 = new Person2(name:"lee2", age:20, dateCreated: new Date(), lastUpdated: new Date())
		p2.save()
		
		
//		return new JsonBuilder().response{
//			code 0
//			message 'success'
//		}
		
		return new Response(code:0, message:'success')
	}
}
